public class LogUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.io.BufferedWriter |
bW
The BufferedWriter used to log to a file.
|
private java.util.HashMap<LogType,java.lang.Boolean> |
fileLogs
The HashMap used for determining which of the logging outputs are logged
to a file.
|
private boolean |
logToFile
The value representing if logging to a file is enabled.
|
private boolean |
logToTerminal
The value representing if logging to the terminal is enabled.
|
private LogLevel |
maxGranularity
The maximum granularity of the logging utility.
|
private java.util.HashMap<LogType,java.lang.Boolean> |
terminalLogs
The HashMap used for determining which of the logging outputs are logged
to the terminal.
|
| Constructor and Description |
|---|
LogUtil(LogLevel maxGranularity,
boolean logToTerminal)
Constructs the logging utility.
|
LogUtil(LogLevel maxGranularity,
boolean[] fileLogs,
boolean[] terminalLogs)
Constructs the logging utility.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroys all logging functionality of the log engine.
|
void |
destroyLogToFile()
Destroys the Logging to File functionality of the log engine.
|
void |
destroyLogToTerminal()
Destroys the Logging to Terminal functionality of the log engine.
|
private void |
log(LogType type,
LogLevel granularity,
java.lang.String detail)
Used to log data.
|
void |
logAlgo(LogLevel level,
java.lang.String detail)
Logs an ALGO message.
|
void |
logError(LogLevel level,
java.lang.String detail)
Logs an ERROR message.
|
void |
logGraph(LogLevel level,
java.lang.String detail)
Logs a GRPH message.
|
void |
logInfo(LogLevel level,
java.lang.String detail)
Logs an INFO message.
|
private void |
reportProblem(java.lang.String problem,
java.lang.String solution)
Used to report problems with the logging engine to the terminal.
|
private void |
setFileLogs(boolean[] fileLogs)
Sets the FileLogs HashMap for selective logging to the file.
|
private void |
setTerminalLogs(boolean[] terminalLogs)
Sets the TerminalLogs HashMap for selective terminal logging.
|
private final java.io.BufferedWriter bW
private boolean logToFile
private boolean logToTerminal
private final LogLevel maxGranularity
private final java.util.HashMap<LogType,java.lang.Boolean> terminalLogs
private final java.util.HashMap<LogType,java.lang.Boolean> fileLogs
public LogUtil(LogLevel maxGranularity, boolean[] fileLogs, boolean[] terminalLogs)
maxGranularity - the maximum granularity of the log messages.fileLogs - the boolean array containing four values.terminalLogs - the boolean array containing four values.public LogUtil(LogLevel maxGranularity, boolean logToTerminal)
maxGranularity - the maximum granularity of the log messages.logToTerminal - the boolean value indicating if logging to terminal
should be enabled.private void setFileLogs(boolean[] fileLogs)
fileLogs - the boolean array containing four values.private void setTerminalLogs(boolean[] terminalLogs)
terminalLogs - the boolean array containing four values.public void destroyLogToFile()
public void destroyLogToTerminal()
public void destroy()
private void reportProblem(java.lang.String problem,
java.lang.String solution)
problem - the String representing the problem that occurred.solution - the String representing the solution the program
utilized.private void log(LogType type, LogLevel granularity, java.lang.String detail)
LogType objects to the method. Instead, there exist
public methods that call this method appropriately.type - the LogType object representing the level of detail for the
log.granularity - the LogLevel object representing how granular this
message is.detail - the String representing the data to be logged.public void logError(LogLevel level, java.lang.String detail)
level - the level of granularity of this message.detail - the String representing the data to be logged.public void logInfo(LogLevel level, java.lang.String detail)
level - the level of granularity of this message.detail - the String representing the data to be logged.public void logAlgo(LogLevel level, java.lang.String detail)
level - the level of granularity of this message.detail - the String representing the data to be logged.public void logGraph(LogLevel level, java.lang.String detail)
level - the level of granularity of this message.detail - the String representing the data to be logged.